<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <div id="app">
    <label for="com1">组件1</label>
    <input type="radio" value="CommonHead1" id="com1" v-model="isComponent">
    <label for="com2">组件2</label>
    <input type="radio" value="CommonHead2" id="com2" v-model="isComponent">
    {{ isComponent }}
    <component :is="isComponent"></component>
  </div>
  <script src="./vue.js"></script>
  <script>
   
    Vue.component('CommonHead1', {
      template: `
        <div>
          <h2>公共组件1</h2>  
        </div>
      `
    })
    Vue.component('CommonHead2', {
      template: `
        <div>
          <h2>公共组件2</h2>  
        </div>
      `
    })
    const vm = new Vue({
      el: '#app',
      data: {
        isComponent: 'CommonHead1'
      }
    })
  </script>
</body>
</html>